USE EMODE
GO

------------------------------------------------
--- Partition functions creation ------------------------
------------------------------------------------

CREATE PARTITION FUNCTION WEEK_KEY_RANGE_PFN(NUMERIC(3,0))
AS RANGE LEFT FOR VALUES (
	  52
	, 104
	, 156
	, 208
)

-----------------------------------------------
--- Partition scheme creation ----------------
-----------------------------------------------

--- SHOP_FACTS ------
CREATE PARTITION SCHEME SHOP_FACTS_SCH AS PARTITION WEEK_KEY_RANGE_PFN
TO ( [SHOP_FACTS_97], [SHOP_FACTS_98], [SHOP_FACTS_99], [SHOP_FACTS_00], [SHOP_FACTS_01] )

--- PRODUCT_PROMOTION_FACTS -----
CREATE PARTITION SCHEME PRODUCT_PROMOTION_FACTS_SCH AS PARTITION WEEK_KEY_RANGE_PFN
TO ( [PRODUCT_PROMOTION_FACTS_97], [PRODUCT_PROMOTION_FACTS_98], [PRODUCT_PROMOTION_FACTS_99], [PRODUCT_PROMOTION_FACTS_00], [PRODUCT_PROMOTION_FACTS_01] )

----------------------------------------------